package game.item;

import engine.graphics.IUpdate;
import game.entity.EntityAttributes;
import game.entity.OwningEntityAttributes;

public abstract class Item extends OwningEntityAttributes implements IUpdate{

	private final String name; 
	private boolean hasDirectEffect = true ; 
	private boolean hasReleasedEffect = false ; 
	
	public Item(EntityAttributes attr, String name) {
		super(attr);
		this.name = name ; 
	}
	
	public Item(EntityAttributes attr, String name, boolean hasDirectEffect) {
		this(attr, name);
		this.setHasDirectEffect(hasDirectEffect);
	}
	
	public boolean hasDirectEffect() {
		return hasDirectEffect;
	}

	public void setHasDirectEffect(boolean hasDirectEffect) {
		this.hasDirectEffect = hasDirectEffect;
	}
	
	public void releaseEffectOn(OwningEntityAttributes object){
		object.getAttributes().changeAll(this.getAttributes());
		this.hasReleasedEffect = true ; 
	}
	
	public void invertEffectOn(OwningEntityAttributes object){
		object.getAttributes().changeAll(this.getAttributes().getInversion());
	}
	
	public boolean hasReleasedEffect(){
		return this.hasReleasedEffect ; 
	}

	public String getName(){
		return this.name ; 
	}
	
}
